<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="bo"></div>
    <div class="bo"></div>
    <div id="no">
        <ul>
            <li>胡歌</li>
            <li>彭于晏</li>
            <li>赵玉真</li>
        </ul>
    </div>
    <script>
        // document.getElementsByClassName('类名')
        //   根据类名获取某些元素集合
        var box = document.getElementsByClassName('bo')
        console.log(box);

        console.log('------querySelector()----------');

        //querySelector()返回指定选择器的第一个元素对象 选择器加符号 id是：#  类是：.
        var nos = document.querySelector('#no')
        console.log(nos);
        var lis = document.querySelector('li')
        console.log(lis);

        console.log('-------document.querySelectorAll()--------');

        //document.querySelectorAll()返回指定选择器的所有元素对象集合
        var box1 = document.querySelectorAll('.bo')
        console.log(box1);
        console.dir(box)

        console.log('-------------');

        var lis1 = document.querySelectorAll('li')
        console.log(lis1);
    </script>
</body>

</html>